<!DOCTYPE html>
<html>
<title>Test that when a video is removed on click it does not crash.</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../media-controls.js"></script>
<video controls width=500 preload=none src="../content/60_sec_video.webm"></video>
<script>
async_test(t => {
  const video = document.querySelector('video');

  video.addEventListener('click', t.step_func_done(() => {
    video.parentNode.removeChild(video);
  }), { once: true });

  video.addEventListener('loadedmetadata', t.step_func(() => {
    const coords = videoLeftEdgeCoordinates(video);
    singleTapAtCoordinates(coords[0], coords[1]);
  }));

  video.load();
});
</script>
</html>
